import Vue from 'vue'
import App from './App.vue'
import Vuex from 'vuex'
import router from './router'

import store from './store'
Vue.config.productionTip = false
Vue.use(Vuex)



// 创建全局导航守卫：
router.beforeEach((to,from,next)=>{
    window.console.log(store.state,"store.state")
    if(store.state.userInfo || to.path==="/login"){
         next()
     }else{
        next({
            path:"/login"
        })
     }
});


new Vue({
    store,
    router,
    render: h => h(App),
}).$mount('#app')